using System;
using System.Collections;
namespace fuzzyKittenVNC
{

	abstract public class Observer {
		protected ArrayList observed = new ArrayList();
		
		public void register(ObservableSubject ob) {
			this.observed.Add(ob);
		}
		public void unregister(ObservableSubject ob) {
			this.observed.Remove(ob);
		}
		
		abstract public void update();
		
	}
	
	abstract public class ObservableSubject
	{
		protected ArrayList observer = new ArrayList();
		
		public void register(Observer ob) {
			this.observer.Add(ob);
			ob.register(this);
		}
		public void unregister(Observer ob) {
			this.observer.Remove(ob);
			ob.unregister(this);
		}
		
		abstract public Object getStatus();
	
		public void notify() {
			foreach(Observer ob in observer) {
				ob.update();
			}	
		}
	}
	
}

